void main() {
  var res =
      'chapters: List<CourseChapter>.from(json["chapters"].map((x) => CourseChapter.fromJson(x))),';
  res.replaceAllMapped(
    RegExp(r'from\(json\["(\w+)"\]\.map'),
    (match) {
      print(match.group(0));
      return 'from((json["${match.group(1)}"] ?? []).map';
    },
  );
  print(res);
}
